package cn.jaye.fabric.common.filter;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * 重写reponse
 *
 * @author Jaye
 * @create 2017-12-05 16:22
 */
public class MyHttpServletResponseWrapper extends HttpServletResponseWrapper {

    private CharArrayWriter ref_charArrayWriter = new CharArrayWriter();

    public MyHttpServletResponseWrapper(HttpServletResponse response) {
        super(response);
    }

    @Override
    public PrintWriter getWriter() throws IOException {
        return new PrintWriter(ref_charArrayWriter);
    }

    public CharArrayWriter getCharArrayWriter() {
        return ref_charArrayWriter;
    }
}
